<%@page contentType="text/html;charset=UTF-8"%>
<%@page pageEncoding="UTF-8"%>
<%@ include file="/pub/includ.jsp"%>
<script type="text/javascript">
	  $(document).ready(function(){
	        $.formValidator.initConfig({formid:"portlet4form",alertmessage:false,onerror:function(msg){alert(msg)}});
			$("#picpath").formValidator().inputValidator({min:1,max:500,onerror:"图片路径不得为空！"});
            
            $("#picwidth").formValidator({empty:"true"}).inputValidator({min:0,type:"value",onerror:"图片宽度必须是数字"});
            $("#picheight").formValidator({empty:"true"}).inputValidator({min:0,type:"value",onerror:"图片高度必须是数字"});
			$("#picsytle").formValidator({empty:"true"}).inputValidator({min:1,max:250,onerror:"内容样式不能超过250个字符"});
			$("#cssname").formValidator({empty:"true"}).inputValidator({min:1,max:100,onerror:"内容样式名称不能超过100个字符"});
           
            $("#title").formValidator({empty:"true"}).inputValidator({min:1,max:250,onerror:"portlet名称过长"});
            $("#portletwidth").formValidator().inputValidator({min:0,max:1500,type:"value",onerror:"portlet宽度必须是0-1500之间的数组"});
            $("#portletheight").formValidator().inputValidator ({min:0,max:5000,type:"value",onerror:"portlet高度必须是0-5000之间的数组"});
	  });
	  
	  var save = function(){
			var flag = "failure";
			if($.formValidator.pageIsValid()){
				var options = {
					type: 'POST',
					async: false,
					dataType: 'content-type',
					success: function(msg) {
						flag = "success";
					}
				}
				$('#portlet4form').ajaxSubmit(options);
			}
			return flag;
		}
		
	function selectColor(){
        opendailog("{src:'<%=path %>/resources/component/farbtastic/demo1.jsp?color="+$('#titlecolor').val().substring(1,$('#titlecolor').val().length)+"',title:'选取颜色',width:320,height:300,savefunc:'savefunc1'}",window);
	}
	function selectImage(){
		opendailog("{src:'<%=path %>/res/get/selectImageIndex',title:'选取图片',width:600,height:400,savefunc:'savefunc2'}",window);
	}
	function savefunc2(frame){
		var retv = frame.contentWindow.save();
		if(retv){
			$('#picpath').val(retv);
			return "success";		
		}
	}
	
	function savefunc1(frame){
		var retv = frame.contentWindow.save();
		$('#titlecolor').val(retv);
		return "success";
	}
	
	function selectImage1(){
		opendailog("{src:'<%=path %>/res/get/selectImageIndex',title:'选取图片',width:600,height:400,savefunc:'savefunc3'}",window);
	}
	function savefunc3(frame){
		var retv = frame.contentWindow.save();
		if(retv){
			$('#titlepic').val(retv);
			return "success";		
		}
	}
</script>
<form id="portlet4form"  action="<%=path%>/cms/portlet/saveportlet4" method="post" target="_self">
<table><tr><td height="2px"></td></tr></table>
<table align="center" border="0" cellpadding="0" cellspacing="1" class="table_nbw" >
	<thead class="th_nbw">
	<tr>
		<td colspan="2" align="center"><strong>图片展现设置</strong></td>
	</tr>
	</thead>
	<tr >
		<td align="right" width="30%"  style="background-color:fff;height:25px;">图片路径</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="picpath" name="picpath" value="${portlet4.picpath}">
			<input type = "button"  value = "选择"  onclick = "selectImage();">
		</td>
	</tr>
	<tr >
		<td align="right" width="30%"  style="background-color:fff;height:25px;">图片宽度</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="picwidth" name="picwidth" value="${portlet4.picwidth}"></td>
	</tr>
	<tr >
		<td align="right" width="30%"  style="background-color:fff;height:25px;">图片高度</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="picheight" name="picheight" value="${portlet4.picheight}"></td>
	</tr>
	<tr >
		<td align="right" width="30%"  style="background-color:fff;height:25px;">图片样式</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="picsytle" name="picsytle" value="${portlet4.picsytle}"></td>
	</tr>
	<tr >
		<td align="right" width="30%"  style="background-color:fff;height:25px;">样式名称</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="cssname" name="cssname" value="${portlet4.cssname}"></td>
	</tr>
	<tr >
		<td align="right" width="30%"  style="background-color:fff;height:25px;">显示模板</td>
		<td align="left" style="background-color:fff">&nbsp;
			<select name="templateid" style="width:120">
			<c:forEach var="template" items="${templateList}"> 
				<option value='${template.id}' ${template.id==portlet4.templateid?'selected':''}>
					${template.name}
				</option> 
			</c:forEach> 
			</select>
		</td>
	</tr>
	<tr >
		<td align="right" width="30%"  style="background-color:fff;height:25px;">portlet名称</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="title" name="title" value="${portlet4.title}"></td>
	</tr>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">portlet名称展示类型</td>
		<td align="left" style="background-color:fff">&nbsp;
			<label><input type="radio" value="0" checked="checked" name="titletype" />样式</lable>
			&nbsp;&nbsp;&nbsp;&nbsp; 
			<label><input type="radio" value="1" ${portlet4.titletype=="1"?'checked=checked':''} name="titletype" />图片</label>
		</td>
	</tr>
	<tr >
		<td align="right" width="30%"  style="background-color:fff;height:25px;">portlet名称样式</td>
		<td align="left" style="background-color:fff">&nbsp;
			<select name="titlecolor" style="width:120">
				<option value='portal_title1' ${portlet4.titlecolor=='portal_title1'?'selected':''}>标题1</option> 
				<option value='portal_title2' ${portlet4.titlecolor=='portal_title2'?'selected':''}>标题2</option> 
				<option value='portal_title3' ${portlet4.titlecolor=='portal_title3'?'selected':''}>标题3</option> 
				<option value='portal_title4' ${portlet4.titlecolor=='portal_title4'?'selected':''}>标题4</option> 
				<option value='portal_title5' ${portlet4.titlecolor=='portal_title5'?'selected':''}>标题5</option> 
				<option value='portal_title6' ${portlet4.titlecolor=='portal_title6'?'selected':''}>标题6</option> 
			</select>
		</td>
	</tr>
	<tr >
		<td align="right" width="30%"  style="background-color:fff;height:25px;">portlet名称图片</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="titlepic" name="titlepic" value="${portlet4.titlepic}">
			<input type = "button"  value = "选择"  onclick = "selectImage1();">
		</td>
	</tr>
	<tr >
		<td align="right" width="30%"  style="background-color:fff;height:25px;">portlet长度</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="portletwidth" name="portletwidth" value="${portlet4.portletwidth}"></td>
	</tr>
	<tr >
		<td align="right" width="30%"  style="background-color:fff;height:25px;">portlet高度</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="portletheight" name="portletheight" value="${portlet4.portletheight}"></td>
	</tr>
</table>
<input type=hidden name="id" value="${portlet4.id}" />
<input type=hidden name="showstate" value="1" />
<input type="hidden" id="portletype" name="portletype" value="pictrue">
<input type="hidden" name="horderChannelId" value="${param.horderChannelId}"/>
<input type="hidden" name="placeholderId" value="${param.placeholderId}"/>
</form>


